<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/template.xhtml">
	<ui:define name="content">
		<h:form>
			<div class="middle">
				<h:messages class="myError" id="errors" />
				<h:outputText value="&lt;br/&gt;" escape="false" />
				<h3>
					<h:outputText value="#{msg.OM_request_manage}">
					</h:outputText>
				</h3>
				<h:outputText value="&lt;br/&gt;" escape="false" />
				<h:outputText value="#{msg.OM_request_selReqtype}"></h:outputText>
				<h:selectOneMenu id="select" value="#{tb.ticketType}"
					valueChangeListener="#{tb.renderTables}" onchange="submit()">
					<f:selectItems value="#{tb.ticketFrom}"></f:selectItems>
				</h:selectOneMenu>
				<h:outputText value="&lt;br/&gt;" escape="false" />
				<h:outputText value="&lt;br/&gt;" escape="false" />
			</div>

			<h:dataTable id="dataTabel" class="table" border="1"
				value="#{tb.resTickets}" var="ticket" rendered="#{tb.ticketType eq 'Basic user'}">
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_user}">
						</h:outputText>
					</f:facet>
					<h:outputText class="blinkytext"
						value="#{tb.getUser(ticket.idUser).name}"
						rendered="#{ticket.status eq 'Pending'}"></h:outputText>
					<h:outputText value="#{tb.getUser(ticket.idUser).name}"
						rendered="#{ticket.status != 'Pending'}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_date}">
						</h:outputText>
					</f:facet>
					<h:outputText class="blinkytext" value="#{ticket.date}"
						rendered="#{ticket.status eq 'Pending'}">
						<f:convertDateTime pattern="dd.MM.yyyy" />
					</h:outputText>
					<h:outputText value="#{ticket.date}"
						rendered="#{ticket.status != 'Pending'}">
						<f:convertDateTime pattern="dd.MM.yyyy" />
					</h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_request}">
						</h:outputText>
					</f:facet>
					<h:outputText class="blinkytext"
						value="#{tb.getResource(ticket.idResource).name}"
						rendered="#{ticket.status eq 'Pending'}"></h:outputText>
					<h:outputText value="#{tb.getResource(ticket.idResource).name}"
						rendered="#{ticket.status != 'Pending'}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_status}">
						</h:outputText>
					</f:facet>
					<h:outputText class="blinkytext" value="#{ticket.status}"
						rendered="#{ticket.status eq 'Pending'}"></h:outputText>
					<h:outputText value="#{ticket.status}"
						rendered="#{ticket.status != 'Pending'}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_action}">
						</h:outputText>
					</f:facet>
					<h:commandButton class="button" id="butonR" value="Reply"
						type="submit" actionListener="#{tb.setTicketId}"
						rendered="#{ticket.status eq 'Pending'}">
						<f:attribute name="ticketid" value="#{ticket.id}" />
						<f:attribute name="tickettype" value="request" />
					</h:commandButton>
				</h:column>
			</h:dataTable>

			<h:dataTable class="table" border="1" value="#{tb.techTickets}"
				var="ticket" rendered="#{tb.ticketType eq 'Technical Support'}">
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_user}">
						</h:outputText>
					</f:facet>
					<h:outputText class="blinkytext"
						value="#{tb.getUser(ticket.idUser).name}"
						rendered="#{ticket.status eq 'Processing'}"></h:outputText>
					<h:outputText value="#{tb.getUser(ticket.idUser).name}"
						rendered="#{ticket.status != 'Processing'}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_date}">
						</h:outputText>
					</f:facet>
					<h:outputText class="blinkytext" value="#{ticket.date}"
						rendered="#{ticket.status eq 'Processing'}">
						<f:convertDateTime pattern="dd.MM.yyyy" />
					</h:outputText>
					<h:outputText value="#{ticket.date}"
						rendered="#{ticket.status != 'Processing'}">
						<f:convertDateTime pattern="dd.MM.yyyy" />
					</h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_resource}">
						</h:outputText>
					</f:facet>
					<h:outputText class="blinkytext"
						value="#{tb.getTechresource(ticket.idTechresource).name}"
						rendered="#{ticket.status eq 'Processing'}"></h:outputText>
					<h:outputText
						value="#{tb.getTechresource(ticket.idTechresource).name}"
						rendered="#{ticket.status != 'Processing'}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_problemtype}">
						</h:outputText>
					</f:facet>
					<h:outputText class="blinkytext" value="#{ticket.problemtype}"
						rendered="#{ticket.status eq 'Processing'}"></h:outputText>
					<h:outputText value="#{ticket.problemtype}"
						rendered="#{ticket.status != 'Processing'}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_status}">
						</h:outputText>
					</f:facet>
					<h:outputText class="blinkytext" value="#{ticket.status}"
						rendered="#{ticket.status eq 'Processing'}"></h:outputText>
					<h:outputText value="#{ticket.status}"
						rendered="#{ticket.status != 'Processing'}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header">
						<h:outputText value="#{msg.OM_request_action}">
						</h:outputText>
					</f:facet>
					<h:commandButton class="button" id="butonT" value="Reply"
						type="submit" actionListener="#{tb.setTicketId}"
						rendered="#{ticket.status eq 'Processing'}">
						<f:attribute name="ticketid" value="#{ticket.id}" />
						<f:attribute name="tickettype" value="tech" />
					</h:commandButton>
				</h:column>
			</h:dataTable>

            <h:panelGroup
                    rendered="#{tb.ticketType eq 'Leave of absence'}">
                <ui:include src="/manager/dashboard.xhtml" />
            </h:panelGroup>
		</h:form>
	</ui:define>

</ui:composition>
</html>